
When /^I click on (.*) to create a new userstory$/ do |label|
  add_button = @flex.panel(:id => "backlogView").button(:automationName => label)
  add_button.click()
end

When /^enter (.*) as the (.*) of the userstory$/ do |text, field|
  title_text = @flex.panel({:id => 'backlogView'}).text_area({:id => field})
  title_text.input(text)
end

When /^I choose to (.*) the new userstory$/ do |id|
  add_button = @flex.panel({:id => 'backlogView'}).button({:id => id})
  add_button.click
end

Given /^there exists (.*) userstories in the (.*)$/ do |count, list|
  backlog_list = @flex.list({:id => list})
  backlog_list.num_rows.should == count.to_i
end

Then /^there should be (.*) userstories in the (.*)$/ do |count, list|
  backlog_list = @flex.list({:id => list})
  backlog_list.num_rows.should == count.to_i
end

When /^I drag (.*) from the (.*)$/ do |item, list|
  sleep(1)
  list_control = @flex.list({:id => list})
  sleep(1)
  list_control.select(item)
  list_control.drag_start(item)
end

When /^I drop (.*) in the (.*)$/ do |item, list|
  list_control = @flex.list({:id => list})
  list_control.drag_drop('move')
end
